package cn.sjtu.algorithm.bitwise_operation;

import java.util.Scanner;

/**
 * @author syo 2319615164@qq.com
 * @description 计算二进制数字中1的个数
 * @date 2024/5/16
 * @Copyright syo
 */
public class AcWing801 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            int num = in.nextInt();
            System.out.print(getOneCount(num) + " ");
        }

    }

    public static int getOneCount(int num) {
        int res = 0;
        while (num > 0) {
            res++;
            num -= num & (-num);
        }
        return res;
    }
}
